home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Microsoft Plateform / Visual Basic 5.0 / Msvb50.ace / msvb50 / MSVB50 / VB / TEMPLATE / FORMS / BROWSER.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-10-24  |  8.3 KB  |  244 lines

  1. VERSION 5.00
  2. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.1#0"; "comctl32.ocx"
  3. Object = "{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}#1.0#0"; "shdocvw.dll"
  4. Begin VB.Form frmBrowser 
  5.    ClientHeight    =   5130
  6.    ClientLeft      =   3060
  7.    ClientTop       =   3345
  8.    ClientWidth     =   6540
  9.    LinkTopic       =   "Form1"
  10.    MDIChild        =   -1  'True
  11.    ScaleHeight     =   5130
  12.    ScaleWidth      =   6540
  13.    ShowInTaskbar   =   0   'False
  14.    Begin SHDocVwCtl.WebBrowser brwWebBrowser 
  15.       Height          =   3734
  16.       Left            =   50
  17.       TabIndex        =   0
  18.       Top             =   1215
  19.       Width           =   5393
  20.       Object.Height          =   249
  21.       Object.Width           =   360
  22.       AutoSize        =   0
  23.       ViewMode        =   1
  24.       AutoSizePercentage=   0
  25.       AutoArrange     =   -1  'True
  26.       NoClientEdge    =   -1  'True
  27.       AlignLeft       =   0   'False
  28.    End
  29.    Begin VB.Timer timTimer 
  30.       Enabled         =   0   'False
  31.       Interval        =   5
  32.       Left            =   6180
  33.       Top             =   1500
  34.    End
  35.    Begin ComctlLib.Toolbar tbToolBar 
  36.       Align           =   1  'Align Top
  37.       Height          =   420
  38.       Left            =   0
  39.       TabIndex        =   3
  40.       Top             =   0
  41.       Width           =   6540
  42.       _ExtentX        =   11536
  43.       _ExtentY        =   741
  44.       Appearance      =   1
  45.       ImageList       =   "imlIcons"
  46.       BeginProperty Buttons {7791BA41-E020-11CF-8E74-00A0C90F26F8} 
  47.          NumButtons      =   6
  48.          BeginProperty Button1 {7791BA43-E020-11CF-8E74-00A0C90F26F8} 
  49.             Key             =   "Back"
  50.             Object.ToolTipText     =   "Back"
  51.             Object.Tag             =   ""
  52.             ImageIndex      =   1
  53.          EndProperty
  54.          BeginProperty Button2 {7791BA43-E020-11CF-8E74-00A0C90F26F8} 
  55.             Key             =   "Forward"
  56.             Object.ToolTipText     =   "Forward"
  57.             Object.Tag             =   ""
  58.             ImageIndex      =   2
  59.          EndProperty
  60.          BeginProperty Button3 {7791BA43-E020-11CF-8E74-00A0C90F26F8} 
  61.             Key             =   "Stop"
  62.             Object.ToolTipText     =   "Stop"
  63.             Object.Tag             =   ""
  64.             ImageIndex      =   3
  65.          EndProperty
  66.          BeginProperty Button4 {7791BA43-E020-11CF-8E74-00A0C90F26F8} 
  67.             Key             =   "Refresh"
  68.             Object.ToolTipText     =   "Refresh"
  69.             Object.Tag             =   ""
  70.             ImageIndex      =   4
  71.          EndProperty
  72.          BeginProperty Button5 {7791BA43-E020-11CF-8E74-00A0C90F26F8} 
  73.             Key             =   "Home"
  74.             Object.ToolTipText     =   "Home"
  75.             Object.Tag             =   ""
  76.             ImageIndex      =   5
  77.          EndProperty
  78.          BeginProperty Button6 {7791BA43-E020-11CF-8E74-00A0C90F26F8} 
  79.             Key             =   "Search"
  80.             Object.ToolTipText     =   "Search"
  81.             Object.Tag             =   ""
  82.             ImageIndex      =   6
  83.          EndProperty
  84.       EndProperty
  85.       MouseIcon       =   "Browser.frx":0000
  86.    End
  87.    Begin VB.PictureBox picAddress 
  88.       Align           =   1  'Align Top
  89.       BorderStyle     =   0  'None
  90.       Height          =   675
  91.       Left            =   0
  92.       ScaleHeight     =   675
  93.       ScaleWidth      =   6540
  94.       TabIndex        =   4
  95.       TabStop         =   0   'False
  96.       Top             =   420
  97.       Width           =   6540
  98.       Begin VB.ComboBox cboAddress 
  99.          Height          =   315
  100.          Left            =   45
  101.          TabIndex        =   2
  102.          Text            =   "
  103. END!"
  104.          Top             =   300
  105.          Width           =   3795
  106.       End
  107.       Begin VB.Label lblAddress 
  108.          Caption         =   "&Address:"
  109.          Height          =   255
  110.          Left            =   45
  111.          TabIndex        =   1
  112.          Tag             =   "&Address:"
  113.          Top             =   60
  114.          Width           =   3075
  115.       End
  116.    End
  117.    Begin ComctlLib.ImageList imlIcons 
  118.       Left            =   2670
  119.       Top             =   2325
  120.       _ExtentX        =   1005
  121.       _ExtentY        =   1005
  122.       BackColor       =   -2147483643
  123.       ImageWidth      =   24
  124.       ImageHeight     =   24
  125.       MaskColor       =   12632256
  126.       BeginProperty Images {8556BCD1-E01E-11CF-8E74-00A0C90F26F8} 
  127.          NumListImages   =   6
  128.          BeginProperty ListImage1 {8556BCD3-E01E-11CF-8E74-00A0C90F26F8} 
  129.             Picture         =   "Browser.frx":001C
  130.             Key             =   ""
  131.          EndProperty
  132.          BeginProperty ListImage2 {8556BCD3-E01E-11CF-8E74-00A0C90F26F8} 
  133.             Picture         =   "Browser.frx":02FE
  134.             Key             =   ""
  135.          EndProperty
  136.          BeginProperty ListImage3 {8556BCD3-E01E-11CF-8E74-00A0C90F26F8} 
  137.             Picture         =   "Browser.frx":05E0
  138.             Key             =   ""
  139.          EndProperty
  140.          BeginProperty ListImage4 {8556BCD3-E01E-11CF-8E74-00A0C90F26F8} 
  141.             Picture         =   "Browser.frx":08C2
  142.             Key             =   ""
  143.          EndProperty
  144.          BeginProperty ListImage5 {8556BCD3-E01E-11CF-8E74-00A0C90F26F8} 
  145.             Picture         =   "Browser.frx":0BA4
  146.             Key             =   ""
  147.          EndProperty
  148.          BeginProperty ListImage6 {8556BCD3-E01E-11CF-8E74-00A0C90F26F8} 
  149.             Picture         =   "Browser.frx":0E86
  150.             Key             =   ""
  151.          EndProperty
  152.       EndProperty
  153.    End
  154. Attribute VB_Name = "frmBrowser"
  155. Attribute VB_GlobalNameSpace = False
  156. Attribute VB_Creatable = False
  157. Attribute VB_PredeclaredId = True
  158. Attribute VB_Exposed = False
  159. Option Explicit
  160. Public StartingAddress As String
  161. Dim mbDontNavigateNow As Boolean
  162. Private Sub Form_Load()
  163.     On Error Resume Next
  164.     Me.Show
  165.     tbToolBar.Refresh
  166.     Form_Resize
  167.     cboAddress.Move 50, lblAddress.Top + lblAddress.Height + 15
  168.     If Len(StartingAddress) > 0 Then
  169.         cboAddress.Text = StartingAddress
  170.         cboAddress.AddItem cboAddress.Text
  171.         'try to navigate to the starting address
  172.         timTimer.Enabled = True
  173.         brwWebBrowser.Navigate StartingAddress
  174.     End If
  175. End Sub
  176. Private Sub brwWebBrowser_DownloadComplete()
  177.     On Error Resume Next
  178.     Me.Caption = brwWebBrowser.LocationName
  179. End Sub
  180. Private Sub brwWebBrowser_NavigateComplete(ByVal URL As String)
  181.     Dim i As Integer
  182.     Dim bFound As Boolean
  183.     Me.Caption = brwWebBrowser.LocationName
  184.     For i = 0 To cboAddress.ListCount - 1
  185.         If cboAddress.List(i) = brwWebBrowser.LocationURL Then
  186.             bFound = True
  187.             Exit For
  188.         End If
  189.     Next i
  190.     mbDontNavigateNow = True
  191.     If bFound Then
  192.         cboAddress.RemoveItem i
  193.     End If
  194.     cboAddress.AddItem brwWebBrowser.LocationURL, 0
  195.     cboAddress.ListIndex = 0
  196.     mbDontNavigateNow = False
  197. End Sub
  198. Private Sub cboAddress_Click()
  199.     If mbDontNavigateNow Then Exit Sub
  200.     timTimer.Enabled = True
  201.     brwWebBrowser.Navigate cboAddress.Text
  202. End Sub
  203. Private Sub cboAddress_KeyPress(KeyAscii As Integer)
  204.     On Error Resume Next
  205.     If KeyAscii = vbKeyReturn Then
  206.         cboAddress_Click
  207.     End If
  208. End Sub
  209. Private Sub Form_Resize()
  210.     cboAddress.Width = Me.ScaleWidth - 100
  211.     brwWebBrowser.Width = Me.ScaleWidth - 100
  212.     brwWebBrowser.Height = Me.ScaleHeight - (picAddress.Top + picAddress.Height) - 100
  213. End Sub
  214. Private Sub timTimer_Timer()
  215.     If brwWebBrowser.Busy = False Then
  216.         timTimer.Enabled = False
  217.         Me.Caption = brwWebBrowser.LocationName
  218.     Else
  219.         Me.Caption = "Working..."
  220.     End If
  221. End Sub
  222. Private Sub tbToolBar_ButtonClick(ByVal Button As Button)
  223.     On Error Resume Next
  224.      
  225.     timTimer.Enabled = True
  226.      
  227.     Select Case Button.Key
  228.         Case "Back"
  229.             brwWebBrowser.GoBack
  230.         Case "Forward"
  231.             brwWebBrowser.GoForward
  232.         Case "Refresh"
  233.             brwWebBrowser.Refresh
  234.         Case "Home"
  235.             brwWebBrowser.GoHome
  236.         Case "Search"
  237.             brwWebBrowser.GoSearch
  238.         Case "Stop"
  239.             timTimer.Enabled = False
  240.             brwWebBrowser.Stop
  241.             Me.Caption = brwWebBrowser.LocationName
  242.     End Select
  243. End Sub
  244.